/*
 * 作者:熊猫
 * 日期:2017 - 3 - 14 10 - 55 - 40
 *
 */

package net.lainiao.morethread.Chapter6.demo2;

import java.util.Date;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;

/**
 * Created by Administrator on 2017/3/14.
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        LinkedBlockingDeque<String> list=new LinkedBlockingDeque<>(3);
        Client  client=new Client(list);
        Thread thread=new Thread(client);
        thread.start();
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 5; j++) {
                String request=list.take();
                System.out.println("Main Request:"+request+" Time: "+ new Date().getTime());
            }
        }
        TimeUnit.SECONDS.sleep(1);
        System.out.println("Main Method is Over ==="+list.size());
    }
}
